import UIKit

// MARK - Frame
extension UIView {
    
    var x: CGFloat {
        set { frame.origin.x = newValue }
        
        get { return frame.origin.x }
    }
    
    var y: CGFloat {
        set { frame.origin.y = newValue }
        
        get { return frame.origin.y }
    }
    
    var width: CGFloat {
        set { frame.size.width = newValue }
        
        get { return frame.size.width }
    }
    
    var height: CGFloat {
        set { frame.size.height = newValue }
        
        get { return frame.size.height }
    }
    
    var origin: CGPoint {
        set { frame.origin = newValue }
        
        get { return frame.origin }
    }
    
    var size: CGSize {
        set { frame.size = newValue }
        
        get { return frame.size }
    }
    
    var top: CGFloat {
        set { y = newValue }
        
        get { return y }
    }
    
    var left: CGFloat {
        set { x = newValue }
        
        get { return x }
    }
    
    var bottom: CGFloat {
        set { height = UIScreen.screenHeight - y - newValue }
        
        get { return UIScreen.screenHeight - CGRectGetMaxY(frame) }
    }
    
    var right: CGFloat {
        set { width = UIScreen.screenWidth - x - newValue }
        
        get { return UIScreen.screenWidth - CGRectGetMaxX(frame) }
    }
    
    var maxX: CGFloat {
        get {
            return x + width
        }
    }
    
    var maxY: CGFloat {
        get {
            return y + height
        }
    }
}
